package com.xja.dubbo.service.impl;

import com.xja.dubbo.entity.Orderinfo;
import com.xja.dubbo.mapper.OrderinfoMapper;
import com.xja.dubbo.service.OrderInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 作者：罗帅
 * 当前类所在包：com.xja.dubbo.service.impl
 * 创建时间：2022/8/18下午 1:13 星期四
 * 此类简介：
 */
@Service("orderInfoService")
public class OrderInfoServiceImpl implements OrderInfoService{
    @Autowired
    private OrderinfoMapper orderInfoMapper;

    public OrderInfoServiceImpl() {
        System.out.println("创建了OrderInfoServiceImpl对象");
    }

    /**
     * 查询所有的订单
     * @return
     */
    public List<Orderinfo> findAll() {
        return orderInfoMapper.findAll();
    }

    /**
     * 添加订单信息
     * @param orderinfo
     * @return
     */
    public int addOrder(Orderinfo orderinfo) {
        return orderInfoMapper.insertSelective(orderinfo);
    }
}
